<?php
/**
 * Author: Hancock
 * Email: 84622365@qq.com
 * Date: 7/18/2016
 * Des: 会员红包
 */
defined('INHkMvc') or exit('Access Invalid!');

class App_member_red_packetModel extends AppModel
{
    public function editMemberRedPacket($data){
        if(!array_key_exists('member_id', $data) && array_key_exists('ad_zone_id', $data)){
            return false;
        }
        $ad_zone_id=trim($data['ad_zone_id']);
        if($this->find(['ad_zone_id'=>$ad_zone_id])){
            unset($data['ad_zone_id']);
            unset($data['member_id']);
            return $this->update($data,['ad_zone_id'=>$ad_zone_id]);
        }else{
            return $this->insert($data);
        }
    }
}
